# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: ScrumpyJack <scrumpyjack@st.ilet.to>
pkgname=gammu
pkgver=1.42.0
pkgrel=1
pkgdesc="Gammu provides an abstraction layer for cell phones access"
options="!check" # 466 - test_sql_time (Failed)
url="https://wammu.eu/"
arch="all"
license="GPL-2.0-or-later"
depends="bluez dialog"
makedepends="
	bluez-dev
	cmake
	curl-dev
	doxygen
	gettext-dev
	libdbi-dev
	libintl
	libpq-dev
	libusb-dev
	linux-headers
	mysql-dev
	samurai
	unixodbc-dev
	"
subpackages="
	$pkgname-smsd:_smsd
	$pkgname-doc
	$pkgname-dev
	$pkgname-libs
	$pkgname-lang
	"
source="https://dl.cihar.com/gammu/releases/gammu-$pkgver.tar.bz2
	include-sys-select-h.patch
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DWITH_NOKIA_SUPPORT=ON \
		-DWITH_BLUETOOTH=ON \
		-DWITH_IRDA=ON \
		-DLIBINTL_LIBRARIES=intl
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

_smsd() {
	pkgdesc="Gammu SMS daemon"

	amove usr/bin/gammu-smsd
	amove usr/bin/gammu-smsd-monitor
	amove usr/bin/gammu-smsd-inject
}

sha512sums="
f440df357578ce7f5ddd17f2f0f6405b4dacbca3e5da65a469f3f1e92c71bf899a7ef0977438c803ed9b1d7d15324d4a43bd9d97d986119a522243e2e6304971  gammu-1.42.0.tar.bz2
bcdbfa620dff24a01033bb670ec4dabae4c691224693d21105c6ca3cd30022b5825ad0669fd6325553b084d90bbde164113b08de7d102c7401d84076b9a59083  include-sys-select-h.patch
"
